package pattern.observer.userdefined.observer

import pattern.observer.userdefined.subject.WeatherData

/**
 * Created by root on 15-9-17.
 */
class CurrentConditionDisplay(weatherData: WeatherData) extends DisplayElement{

  private var temperature:Float = _
  private var humidity:Float = _

  override def display(): Unit = {
    println("Current conditions:"+temperature+"F degrees and "+humidity+"% humidity")
  }

  override def update(temp: Float, humidity: Float, pessure: Float): Unit = {
    this.temperature=temp
    this.humidity=humidity
    display()
  }

  weatherData.registerObserver(this)

}
